<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script type="text/javascript">

        //编写一个JavaScript对象
        var user = {
            name:"小明",
            age:3,
            sex:"男"
        }

        //将JS对象转换为Json对象
        var json = JSON.stringify(user)
        console.log(json);

        //将Json对象转换为JS对象
        var obj = JSON.parse(json)
        console.log(obj);


        //打印最开始定义的JavaScript对象
        console.log(user);
    </script>
</body>
</html>